package com.bw.heishou.mvp.view;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.bw.heishou.Bean.UserBean;
import com.bw.heishou.HeiApi;
import com.bw.heishou.R;
import com.bw.heishou.mvp.contract.UserContract;
import com.bw.heishou.mvp.model.LogModel;
import com.bw.heishou.mvp.presenter.LogPresenter;
import com.bw.lib_core.mvp.view.BaseActivity;

public  class RegActivity extends BaseActivity<LogPresenter> implements UserContract.User_View  {


    private ImageView regactBackimg;
    private EditText regactUser;
    private EditText regactPass;
    private Button regactRegbtn;
    private static final String TAG = "RegActivity";
    @Override
    public int bandlayout() {
        return R.layout.regactivity;
    }

    @Override
    public void initView() {


        regactBackimg = (ImageView) findViewById(R.id.regact_backimg);
        regactUser = (EditText) findViewById(R.id.regact_user);
        regactPass = (EditText) findViewById(R.id.regact_pass);
        regactRegbtn = (Button) findViewById(R.id.regact_regbtn);


        regactBackimg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        regactRegbtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String s = regactUser.getText().toString();
                String s1 = regactPass.getText().toString();
                if (TextUtils.isEmpty(s)||TextUtils.isEmpty(s1)){
                    ToastUtils.showShort("账号或密码为空");
                    return;
                }
                //注册逻辑
                pPresenter =new LogPresenter(new LogModel(),RegActivity.this);
                pPresenter.regrequest(HeiApi.req,s,s1);
            }
        });
    }

    @Override
    public void initData() {

    }

    @Override
    public void regOk(UserBean userBean) {
        ToastUtils.showShort("注册成功");
        finish();
    }

    @Override
    public void logOk(UserBean userBean) {

    }
}
